/**
	RSSHeadline class - represents the information for an RSS headline, used with RSSChannel class.
	supports RSS 0.91, 1.0, and 2.0

	@author Chandler McWilliams
	@version 2006-05-18
	@usage
		see RSSChannel
		
*/

class timber.rss.RSSHeadline {

	var title;
	var link;
	var description;
	var date;
	var creator;

	/**
		Constructor.
	**/
	public function RSSHeadline() {
		this.title			= 'Untitled';
		this.link			= false;
		this.description	= '';
		this.date			= '';
		this.creator		= '';
	}


	/**
		init the RSSHeadline using data from an XML node
	**/
	public function initWithXML(xml) {
		for (var j=0; j<xml.length; j++) {
			switch (xml[j].nodeName.toLowerCase()) {
				case 'title':
					this.setTitle(xml[j].firstChild.nodeValue);
					break;

				case 'description':
					this.setDescription(xml[j].firstChild.nodeValue);
					break;

				case 'link':
					this.setLink(xml[j].firstChild.nodeValue);
					break;

				case 'dc:date':
					this.setDate(xml[j].firstChild.nodeValue);
					break;

				case 'pubdate':
					this.setDate(xml[j].firstChild.nodeValue);
					break;
					
				case 'dc:creator':
					this.setCreator(xml[j].firstChild.nodeValue);
					break;
			}
				
		}
	}

	// ===========================================================
	// - ACCESSOR FUNCTIONS
	// ===========================================================
	public function getTitle() {return this.title;}
	public function setTitle(title) {	this.title = title;}

	public function getLink() {return this.link;}
	public function setLink(link) {	this.link = link}

	public function getDescription() {return this.description;}
	public function setDescription(description) {	this.description = description;}

	public function getDate() {return this.date;}
	public function setDate(date) {	this.date = date;}

	public function getCreator() {return this.creator;}
	public function setCreator(creator) {	this.creator = creator;}
}